#!/bin/bash
#获取磁盘信息

readonly functions_name="public_functions" #文件名称
readonly functions_url="$(find / -path /proc -prune -o -name $functions_name -print)" #获取文件路径

if [[ -n $functions_url ]]; then #查找函数文件并加载

    for i in $functions_url; do . $i; done
else
    echo "Not fount $functions_name"
fi


get_diskinfo() {

  for i in 127.0.0.1; do
    logW "主机$i (磁盘信息):"
    df -h | awk 'BEGIN { printf "%-5s%-5s%-5s%-5s%-5s\n","挂载点","容量","已用","可用","使用百分比" }'
    df -h | awk '/\/$/{ printf "%-8s%-7s%-7s%-10s%-5s\n",$6,$2,$3,$4,$5 }'
    echo
  done
}
